<?php

add_filter( 'rwmb_meta_boxes', 'vnnews_register_adv_meta_boxes' );

function vnnews_register_adv_meta_boxes( $meta_boxes )
{
	$prefix = 'adv_';

	$meta_boxes[] = array(
		'id' => 'adv-meta-box',
		'title' => __( 'Advertise options', 'meta-box' ),
		'pages' => array( 'advertise'),
		'context' => 'normal',
		'priority' => 'high',
		'autosave' => true,
		'fields' => array(
			array(
				'name' => __( 'Upload image', 'meta-box' ),
				'id'   => "{$prefix}url",
				'type' => 'image_advanced',
			),
			array(
				'name'  => __( 'Advertise width', 'meta-box' ),
				'id'    => "{$prefix}width",
				'desc'  => __( '', 'meta-box' ),
				'type'  => 'text',
				'std'   => __( '', 'meta-box' ),
				'clone' => false,
				'size'	=> 10
			),
			array(
				'name'  => __( 'Advertise Height', 'meta-box' ),
				'id'    => "{$prefix}height",
				'desc'  => __( '', 'meta-box' ),
				'type'  => 'text',
				'std'   => __( '', 'meta-box' ),
				'clone' => false,
				'size'	=> 10
			),
			array(
				'name'     => __( 'Advertise target', 'meta-box' ),
				'id'       => "{$prefix}target",
				'type'     => 'select',
				'desc'	   => 'Apply for type of advertise is Image',
				// Array of 'value' => 'Label' pairs for select box
				'options'  => array(
					'_blank' => __( '_blank', 'meta-box' ),
					'_self' => __( '_self', 'meta-box' ),
					'_parent' => __( '_parent', 'meta-box' ),
					'_top' => __( '_top', 'meta-box' )
				),
				// Select multiple values, optional. Default is false.
				'multiple'    => false,
				'std'         => ''
			),
			array(
				'name'  => __( 'Advertise Link', 'meta-box' ),
				'id'    => "{$prefix}link",
				'desc'  => __( 'Apply for type of advertise is Image, link of image', 'meta-box' ),
				'type'  => 'text',
				'std'   => __( '', 'meta-box' ),
				'clone' => false,
				'size'	=> 60
			),
			array(
				'name'  => __( 'Order', 'meta-box' ),
				'id'    => "{$prefix}order",
				'desc'  => __( 'Display order when have many advertise', 'meta-box' ),
				'type'  => 'text',
				'std'   => __( '1', 'meta-box' ),
				'clone' => false,
				'size'	=> 10
			),
			array(
				'name' => __( 'Enable Google Adsense code', 'meta-box' ),
				'id'   => "{$prefix}enable_google_ads",
				'desc' => __( 'Check to display Google advertisement with Adsense code <b style="color:red;">(leave blank all text above)</b>', 'meta-box'),
				'type' => 'checkbox',
				'std'  => 0,
			),
			array(
				'name' => __( 'Google Adsense code', 'meta-box' ),
				'desc' => __( 'Put your Google adsense code here', 'meta-box' ),
				'id'   => "{$prefix}google_ads",
				'type' => 'textarea',
				'cols' => 20,
				'rows' => 10,
			),
		)
	);

	return $meta_boxes;
}
?>